#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File        :   349. 两个数组的交集.py
@Contact     :   lhouctcs@163.com
@License     :   MIT
@Time        :   2023/2/6 12:15
@Author      :   lhou 
@Version     :   0.1.0
@Description :
"""
from typing import List


# import lib
class Solution:
    def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
        val_dict = {}
        ans = []
        for num in nums1:
            val_dict[num] = 1

        for num in nums2:
            if num in val_dict.keys() and val_dict[num] == 1:
                ans.append(num)
                val_dict[num] = 0

        return ans
